<?php

abstract class D
{
	
	public static $db;
	public static $user;
	public static $request;
	
	static final function UnixPath($dir){
		$dir	= str_replace('\\','/',$dir);
		if( $dir[1] === ':' ){
			$dir	= substr($dir, 2);
		}
		return $dir;
	}

	
	static final function loadClass($class_name, $dirs = null) {
		if ( class_exists($class_name, false) || interface_exists($class_name, false) ) {
			return false;
		}
		$class_name	= strtolower($class_name);
		$filename	= D_DIR . '/' . str_replace('_', '/', $class_name).'.php';
		include($filename);
	}


	static final function boostrap(){
		self::$db	= new pdb('mysql:dbname=feed;host=127.0.0.1', 'root', '');		
		self::$db->query("SET CHARACTER SET utf8");

		self::$request	= new request();
		self::$user	= new user();
	}

}

spl_autoload_register(array('D', 'loadClass'));

define('D_DIR', dirname(D::UnixPath(__FILE__)));

?>